package com.wj.service.impl;

import com.wj.pojo.Announcement;
import com.wj.dao.AnnouncementMapper;
import com.wj.service.IAnnouncementService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wj.utils.RespUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wj
 * @since 2022-05-16
 */
@Service
public class AnnouncementServiceImpl extends ServiceImpl<AnnouncementMapper, Announcement> implements IAnnouncementService {
    @Resource
    AnnouncementMapper announcementMapper;

    @Override
    public List<Announcement> searchAnnouncement(String searchText) {
        return announcementMapper.searchAnnouncement(searchText);
    }

    @Override
    public RespUtil deleteAnnouncement(Integer[] ids) {
        if (announcementMapper.deleteAnnouncement(ids) > 0){
            return RespUtil.success("删除成功");
        }
        return RespUtil.error("删除失败");
    }
}
